package gdut.imis.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import gdut.imis.Utils.Result;
import gdut.imis.domain.ClubInstitutionDepartmentStudentRel;
import gdut.imis.enums.Status;
import gdut.imis.mapper.ClubInstitutionDepartmentStudentRelMapper;
import gdut.imis.service.ClubInstitutionDepartmentStudentRelService;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @Description
 * @Author JiaFu
 * @Date 2023/4/7 15:07
 */
@Service
public class ClubInstitutionDepartmentStudentRelServiceImpl extends ServiceImpl<ClubInstitutionDepartmentStudentRelMapper, ClubInstitutionDepartmentStudentRel> implements ClubInstitutionDepartmentStudentRelService {

    /***
     * 新增社团机构部门与学生关联档案
     * @param: clubInstitutionDepartmentStudentRel
     * @return Result
     */
    @Override
    public Result addDepartmentStuRel(ClubInstitutionDepartmentStudentRel clubInstitutionDepartmentStudentRel) {
        if (Objects.isNull(clubInstitutionDepartmentStudentRel)) {
            return Result.errorWithArgs(Status.REQUEST_PARAMS_NOT_VALID_ERROR, "clubInstitutionDepartmentStudentRel");
        }
        boolean flag = this.save(clubInstitutionDepartmentStudentRel);
        if (flag) {
            return Result.success();
        }
        return Result.errorWithArgs(Status.FAILED, "新增社团机构部门与学生绑定档案失败");
    }
}
